import request from '@/utils/request'

// 自动饲喂调用
export function listMsg(query) {
  return request({
    url: '/material/consume/listMsg',
    method: 'get',
    params: query
  })
}

// 查询下拉信息表栏舍编码
export function findCode(query) {
  return request({
    url: '/material/consume/findCode',
    method: 'get',
    params: query
  })
}

// 查询进货信息列表
export function listMaterial(query) {
  return request({
    url: '/material/purchase/list',
    method: 'get',
    params: query
  })
}

// 根据ID获取单个进货信息
export function getPurchase(id) {
  return request({
    url: '/material/purchase/getInfo/' + id,
    method: 'get'
  })
}

// 新增进货信息
export function addPurchase(data) {
  return request({
    url: '/material/purchase/add',
    method: 'post',
    data: data
  })
}

// 修改进货信息
export function updatePurchase(data) {
  return request({
    url: '/material/purchase/update',
    method: 'post',
    data: data
  })
}

// 删除进货信息
export function delPurchase(delId) {
  return request({
    url: '/material/purchase/del/' + delId,
    method: 'delete'
  })
}


// 查询存储信息列表
export function listStore(query) {
  return request({
    url: '/material/store/list',
    method: 'get',
    params: query
  })
}

// 根据ID获取单个存储信息
export function getStore(id) {
  return request({
    url: '/material/store/getInfo/' + id,
    method: 'get'
  })
}

// 根据饲料类型获取数量
export function selectMateriaFeedStoreNum(materiaFeedType) {
  return request({
    url: '/material/store/selectMateriaFeedStoreNum?materiaFeedType=' +materiaFeedType,
    method: 'get',
  })
}

// 新增存储信息
export function addStore(data) {
  return request({
    url: '/material/store/add',
    method: 'post',
    data: data
  })
}

// 修改存储信息
export function updateStore(data) {
  return request({
    url: '/material/store/update',
    method: 'post',
    data: data
  })
}

// 删除存储信息
export function delStore(delId) {
  return request({
    url: '/material/store/del/' + delId,
    method: 'delete'
  })
}


//消耗表
// 查询消耗信息列表
export function listConsume(query) {
  return request({
    url: '/material/consume/list',
    method: 'get',
    params: query
  })
}

//新增消耗记录
export function addConsume(data) {
  return request({
    url: '/material/consume/add',
    method: 'post',
    data: data
  })
}

// 根据ID获取单个消耗记录
export function getConsume(id) {
  return request({
    url: '/material/consume/getInfo/' + id,
    method: 'get'
  })
}


// 修改消耗记录
export function updateConsume(data) {
  return request({
    url: '/material/consume/update',
    method: 'post',
    data: data
  })
}


// 删除消耗记录
export function delConsume(delId) {
  return request({
    url: '/material/consume/del/' + delId,
    method: 'delete'
  })
}

//获取栏舍编号
export function findPhouseCode() {
  return request({
    url: '/material/consume/findPhouseCode',
    method: 'get'
  })
}

//获取物料负责人
export function findAllStaffName() {
  return request({
    url: '/material/consume/findAllStaffName',
    method: 'get'
  })
}

//根据仓库获取该仓库下饲料类型
export function findStoreFeedTypeByPosition(position) {
  return request({
    url: '/material/consume/findStoreFeedTypeByPosition?position=' + position,
    method: 'get'
  })
}

//查村存储数量
export function findStoreNum(type, position) {
  return request({
    url: '/material/consume/findStoreNum?type=' + type + '&position=' + position,
    method: 'get'
  })
}


//饲料类型的API
//查询饲料类型列表
export function listType(query) {
  return request({
    url: '/material/type/list',
    method: 'get',
    params: query
  })
}

// 根据ID获取单个饲料信息
export function getType(id) {
  return request({
    url: '/material/type/getInfo/' + id,
    method: 'get'
  })
}

// 新增类型信息
export function addType(data) {
  return request({
    url: '/material/type/add',
    method: 'post',
    data: data
  })
}

// 修改类型信息
export function updateType(data) {
  return request({
    url: '/material/type/update',
    method: 'post',
    data: data
  })
}

// 删除类型信息
export function delType(delId) {
  return request({
    url: '/material/type/del/' + delId,
    method: 'delete'
  })
}

//获取类型类型  在其他模块作为下拉框出现
export function getTypes() {
  return request({
    url: '/material/type/getTypes/',
    method: 'get'
  })
}

